<template>
  <el-pagination layout="slot">
    <div class="mypagination">
      <span
        >共{{
          page.totalCount
        }}条记录&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;第{{
          page.pageIndex
        }}/{{ sumIndex }}页</span
      >
      <el-button
        type="default"
        :disabled="page.pageIndex === 1"
        @click="findIndex(-1)"
        >上一页</el-button
      >
      <el-button
        type="default"
        :disabled="page.pageIndex === sumIndex"
        @click="findIndex(1)"
        >下一页</el-button
      >
    </div>
  </el-pagination>
</template>

<script>
export default {
  name: 'MyPagination',
  props: {
    page: {
      type: Object,
      required: true
    },
    sumIndex: {
      type: Number,
      required: true
    }
  },
  methods: {
    // 分页
    findIndex (val) {
      this.$emit('updateIndex', val)
    }
  }
}
</script>

<style lang="scss" scoped>
  .mypagination {
    display: flex;
    margin-top: 20px;
    padding: 0 34px 0 14px;
    span {
      flex: 1;
      color: #dbdfe5;
      font-size: 16px;
      font-weight: normal;
    }
    .el-button--default {
      width: 70px;
      height: 32px;
      margin: 0 16px;
      border-radius: 2px;
      background-color: #d5ddf8;
    }
    .is-disabled {
      background-color: #edf0f9;
    }
  }
</style>
